package com.niit.xlztest.service;


import com.niit.xlztest.bean.Comm;

import com.niit.xlztest.repository.CommRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service("commService")
public class CommServiceImpl implements CommService {

    @Autowired
    private CommRepository commRepository;


    @Override
    public void addUser(Comm comm) {

    }

    @Override
    public void addComm(Comm comm) {
 commRepository.save(comm);
    }

    @Override
    public void updateUser(Comm comm) {

    }

    @Override
    public void deleteCommById(Integer comm_id) {
        commRepository.deleteCommById(comm_id);
    }

    @Override
    public void deleteUserById(Integer uid) {

    }

    @Override
    public List<Comm> findAllComms() {
        return (List<Comm>) commRepository.findAll();
    }
    @Override
    public Comm findCommByCommid(String comm_id) {
        return commRepository.findCommByCommid(comm_id);
    }

    @Override
    public List<Comm> findUserByName(String userName) {
        return null;
    }

    @Override
    public List<Comm> findCommByid(String book_id) {
        return (List<Comm>) commRepository.findCommByid(book_id);
    }

}
